package org.batatasframework.support.database.metadatas;

import java.util.Collection;

import org.batatasframework.support.database.TableInfo;

/**
 * 对元表定义的代理封装
 * @author jackson
 *
 */
public abstract class AbstractTableMetadataProxy implements TableMetadata{
	protected final TableMetadata sourceTableMetadata;
	
	protected AbstractTableMetadataProxy(TableMetadata sourceTableMetadata){
		this.sourceTableMetadata = sourceTableMetadata;
	}
	
	@Override
	public TableMetadata getTableMetadata() {
		return sourceTableMetadata.getTableMetadata();
	}

	public TableInfo getTableInfo() {
		return sourceTableMetadata.getTableInfo();
	}

	public String getTableName() {
		return sourceTableMetadata.getTableName();
	}

	public String getPrimaryKey() {
		return sourceTableMetadata.getPrimaryKey();
	}

	public FieldMetadata get(String fieldName) {
		return sourceTableMetadata.get(fieldName);
	}

	public FieldMetadata getOrNull(String key) {
		return sourceTableMetadata.getOrNull(key);
	}

	public Collection<? extends FieldMetadata> getFieldMetadatas() {
		return sourceTableMetadata.getFieldMetadatas();
	}
	
}
